// export default store
// vue3中创建store实例对象的方法createStore()按需引入
import { createStore } from "vuex";

export default createStore({
  state: {
    status: "0",
    showCover: false,
    token: "",
    isAdmin: "0",
    user4a: "",
    examType: "daily",
    trueCount: 0,
    currentIndex: 0,
    totalCount: 0,
    isLimited: false,
    day: "",
    categoryId: "",
    mmsId: "",
    foldId: "",
    areaId: "",
    areaName: "",
    prevAreaId: "",
    drillDownId: "", //下钻时保存areaid
    title: "",
    areaLevel: 0, //用户level
    presentLevel: 0, //存储下钻level,
    type: "",
    from: "", //打开方式...banner,
    drill: "",
    selects: "",
  },
  getters: {
    status: (state) => state.status,
    showCover: (state) => state.showCover,
    token: (state) => state.token,
    isAdmin: (state) => state.isAdmin,
    user4a: (state) => state.user4a,
    examType: (state) => state.examType,
    trueCount: (state) => state.trueCount,
    currentIndex: (state) => state.currentIndex,
    totalCount: (state) => state.totalCount,
    isLimited: (state) => state.isLimited,
    day: (state) => state.day,
    categoryId: (state) => state.categoryId,
    mmsId: (state) => state.mmsId,
    foldId: (state) => state.foldId,
    areaId: (state) => state.areaId,
    areaName: (state) => state.areaName,
    prevAreaId: (state) => state.prevAreaId,
    drillDownId: (state) => state.drillDownId,
    title: (state) => state.title,
    areaLevel: (state) => state.areaLevel,
    presentLevel: (state) => state.presentLevel,
    type: (state) => state.type,
    from: (state) => state.from,
    drill: (state) => state.drill,
    selects: (state) => state.selects,
  },
  mutations: {
    setStatus(state, item) {
      state.status = item;
    },
    setCover(state, item) {
      state.showCover = item;
    },
    setToken(state, item) {
      state.token = item;
    },
    setAdmin(state, item) {
      state.isAdmin = item;
    },
    setUser4a(state, item) {
      state.user4a = item;
    },
    setExamType(state, item) {
      state.examType = item;
    },
    setTrueCount(state, item) {
      state.trueCount = item;
    },
    setCurrentIndex(state) {
      state.currentIndex += 1;
    },
    setTotalCount(state, item) {
      state.totalCount = item;
    },
    setLimited(state, item) {
      state.isLimited = item;
    },
    setDay(state, item) {
      state.day = item;
    },
    setCategoryId(state, item) {
      state.categoryId = item;
    },
    setMmsId(state, item) {
      state.mmsId = item;
    },
    setFoldId(state, item) {
      state.foldId = item;
    },
    setAreaId(state, item) {
      state.areaId = item;
    },
    setAreaName(state, item) {
      state.areaName = item;
    },
    setPrevAreaId(state, item) {
      state.prevAreaId = item;
    },
    setDrillDownId(state, item) {
      state.drillDownId = item;
    },
    setTitle(state, item) {
      state.title = item;
    },
    setAreaLevel(state, item) {
      state.areaLevel = item;
    },
    setPreLevel(state, item) {
      state.presentLevel = item;
    },
    setType(state, item) {
      state.type = item;
    },
    setFrom(state, item) {
      state.from = item;
    },
    setDrill(state, item) {
      state.drill = item;
    },
    setSelects(state, item) {
      state.selects = item;
    },
  },
  actions: {},
  modules: {},
});
